<template>
    <div>{{number}}----{{sum}}

        <button @click="add()">加一</button>
    </div>
    
</template>
<script>
export default {
    name:'WangPang',
    data(){
        return{
            number: 1
        }
    },
    methods:{
        add(){
            this.$data.number += 1
            console.log("监听到改变之后处理的值:",this.sum)
        }
    },
    computed: {
        // 由于number变化而引起的总价变动
        sum: function(){
             return this.$data.number * 10
            // set: val => {this.$data.number = val + 1}

        }
       
    }
}
</script>

<style>

</style>